import { createWebHistory, createRouter } from "vue-router";
import category from "@/views/Category/index.vue"
import login from "@/views/Login/index.vue"
import home from "@/views/Home/index.vue"
import layout from "@/views/Layout/index.vue"

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/login',
      component: login
    },
    {
      path: '/',
      component: layout,
      redirect: '/home',
      children: [
        {
          path: '/home',
          component: home
        },
        {
          // 跳转传参
          path: '/category/:id',
          component: category
        }
      ]
    }
  ]
})

export default router